﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XGameLibrary;
using Microsoft.Xna.Framework.Graphics;
using XGameLibrary.Controls;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using TomShane.Neoforce.Controls;

namespace XGame.GameScreens
{
    public class TitleScreen : XGameScreenBase
    {
        #region Field region

        Texture2D backgroundImage;

        #endregion

        #region Constructor region

        public TitleScreen(Manager Manager, GameScreenManager manager)
            : base(Manager, manager)
        {
        }

        #endregion

        #region XNA Method region
        public override void Initialize()
        {
            Button startbutton;
            startbutton = new Button(manager);
            startbutton.Left = 300;
            startbutton.Top = 500;
            startbutton.Width = 150;
            startbutton.Height = 30;
            startbutton.Text = "Press here to begin";
            startbutton.Color = Color.White;
            startbutton.MousePress += delegate(object sender, MouseEventArgs e)
            {
                Transition(GameScreenManager.ChangeType.Push, GameRef.StartMenuScreen);
            };
            manager.Add(startbutton);
           
            base.Initialize();

        }



        protected override void LoadContent()
        {
            ContentManager Content = GameRef.Content;
            backgroundImage = Content.Load<Texture2D>(@"Image\TitleScreen");
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            ControlManager.Update(gameTime);
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            GameRef.SpriteBatch.Begin();

            base.Draw(gameTime);

            GameRef.SpriteBatch.Draw(
                backgroundImage,
                new Rectangle(
                0,
                0,
                InputHandler.ScreenWidth,
                InputHandler.ScreenHeight),
                Color.White);

            ControlManager.Draw(GameRef.SpriteBatch);

            GameRef.SpriteBatch.End();
        }

        #endregion
    }
}
